source("scripts/myRLib.R")
xt <- read.table("output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xt.assoc.logistic",
header = T)
xt$SNP <- as.character(xt$SNP)
xt <- xt[order(xt$SNP), ]
yi <- read.table("output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/yi.logistic.assoc",
header = T)
xtyi.files <- strsplit("output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p1.0000e+00.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p3.0000e-01.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p1.0000e-01.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p3.0000e-02.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p1.0000e-02.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p3.0000e-03.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p1.0000e-03.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p3.0000e-04.assoc.logistic:output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/xtyi_LDpred_p1.0000e-04.assoc.logistic",
":")[[1]]
ps <- strsplit("1:0.3:0.1:0.03:0.01:0.003:0.001:0.0003:0.0001",
":")[[1]]
for (i in 1:length(xtyi.files)) {
xtyi <- read.table(xtyi.files[i], header = T)
xtyi$SNP <- as.character(xtyi$SNP)
xtyi <- xtyi[order(xtyi$SNP), ]
p <- ps[i]
cat("##", "Cutoff =", p, "\n")
cat("\n")
cat("\n")
cat("Filename is", as.character(yi[i, 1]))
cat("\n")
pander(yi[i, 2:ncol(yi)])
qqplot(-log10((1:length(xt$P))/length(xt$P)), -log10(xt$P),
main = "QQplot - Gi: Y ~ Gi", xlab = "-log10 expected pval",
ylab = "-log10 observed pval")
abline(a = 0, b = 1, col = "red")
qqplot(-log10((1:length(xtyi[xtyi$TEST == "ADD", "P"]))/length(xtyi[xtyi$TEST ==
"ADD", "P"])), -log10(xtyi[xtyi$TEST == "ADD", "P"]),
main = "QQplot - Gi: Y ~ Gi + I", xlab = "-log10 expected pval",
ylab = "-log10 observed pval")
abline(a = 0, b = 1, col = "red")
hist(log(xtyi[xtyi$TEST == "PRS", "OR"]), main = "Hist - I: Y ~ Gi + I",
xlab = "OR")
abline(v = yi[i, "prs.estmate"], col = "red")
abline(v = yi[i, "prs.estmate"] - yi[i, "prs.std"], col = "red")
abline(v = yi[i, "prs.estmate"] + yi[i, "prs.std"], col = "red")
plot(xt$P, xtyi[xtyi$TEST == "ADD", "P"], main = "P-value of Gi: Gi + I vs Gi",
xlab = "Gi", ylab = "Gi + I")
cat("\n")
cat("\n")
}
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p1.0000e+00.txt
| intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|
| -0.5442 | 0.03159 | 1.783e-66 | 0.04442 | 0.01579 | 0.00489 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p3.0000e-01.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 2 | -0.5312 | 0.0306 | 1.597e-67 | 0.03497 | 0.01284 | 0.006466 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p1.0000e-01.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 3 | -0.5227 | 0.03027 | 8.347e-67 | 0.02904 | 0.01118 | 0.009395 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p3.0000e-02.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 4 | -0.516 | 0.03027 | 3.607e-65 | 0.01788 | 0.01069 | 0.09441 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p1.0000e-02.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 5 | -0.4799 | 0.03368 | 4.609e-46 | 0.02872 | 0.01107 | 0.009457 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p3.0000e-03.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 6 | -0.482 | 0.03436 | 1.024e-44 | 0.02622 | 0.01168 | 0.02485 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p1.0000e-03.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 7 | -0.4889 | 0.03418 | 2.106e-46 | 0.02313 | 0.01235 | 0.06111 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p3.0000e-04.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 8 | -0.4911 | 0.0341 | 4.92e-47 | 0.02279 | 0.01296 | 0.07875 |
Filename is output-direction_XT_YI/UKBB_wbc__wtccc_crohn__wtccc_ctrl/covar_LDpred_p1.0000e-04.txt
| Â | intercept.estmate | intercept.std | intercept.pval | prs.estmate | prs.std | prs.pval |
|---|---|---|---|---|---|---|
| 9 | -0.4915 | 0.03403 | 2.709e-47 | 0.02376 | 0.01356 | 0.07976 |